package covertjava.loadtest;

import junit.framework.*;
import junit.extensions.TestDecorator;

/**
 * <p>A test decorator that executes the given test after a specified delay</p>
 * <p>Copyright: Copyright (c) 2004 Sams Publishing</p>
 * @author Alex Kalinovsky
 * @version 1.0
 */
public class DelayedTest extends TestDecorator {
    protected int delay;

    /**
     * Executes the given test after the delay
     * @param test test to run
     * @param delay delay to sleep in milliseconds before running the test
     */
    public DelayedTest(Test test, int delay) {
        super(test);
    }

    public void run(TestResult result) {
        try {
            Thread.currentThread().sleep(delay*1000);
            super.run(result);
        }
        catch(InterruptedException x) {
        }
    }
}
